package com.web;

import com.pojo.JiaoLiu_db;
import com.service.JiaoLiuService_db;
import com.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/jiaoliu")
public class JiaoLiuController_db {
    @Autowired
    private JiaoLiuService_db jiaoLiuServiceDb;

    @RequestMapping("/show")
    public ResultEntity list(String stime,String etime, Integer id){
        return ResultEntity.ok(jiaoLiuServiceDb.list(stime,etime,id));
    }

    @RequestMapping("/all")
    public ResultEntity listAll() {
        return ResultEntity.ok(jiaoLiuServiceDb.listAll());
    }

    @RequestMapping("listid")
    public ResultEntity listById(Integer id,Integer order) {
        return ResultEntity.ok(jiaoLiuServiceDb.listById(id,order));
    }

    @RequestMapping("/add")
    public ResultEntity add(JiaoLiu_db jiaoLiuDb){
        return ResultEntity.ok(jiaoLiuServiceDb.add(jiaoLiuDb));
    }

    @RequestMapping("/update")
    public ResultEntity update(JiaoLiu_db jiaoLiuDb){
        return ResultEntity.ok(jiaoLiuServiceDb.update(jiaoLiuDb));
    }

    @RequestMapping("/delete")
    public ResultEntity del(Integer jId){
        return ResultEntity.ok(jiaoLiuServiceDb.del(jId));
    }
}
